-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Extended Stats Bucket #1756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM. Could you add a changelog entry?
|
||
class ExtendedStatsBucketTest extends BaseAggregationTest | ||
{ | ||
protected function _getIndexForTest(): Index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use private
as method visibility here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still protected
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is till protected
, it should be private
instead
Hello @thePanz I removed all useless comments and annotations ;) Thx ! |
Seems CI is not happy :-( @thePanz Feel free to merge as soon as you are happy and CI is green. |
Hey @thePanz Everything is ok for you ? |
*/ | ||
class ExtendedStatsBucket extends AbstractAggregation | ||
{ | ||
public function __construct(string $name, ?string $bucketsPath = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed it now: why is the bucketPath not required in the constructor, but later required when building the request( toArray()
)?
As it is required, I'd make it required (not empty) and remove the setBucketPath()
method. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolassing ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thePanz Perhaps the same argument as in the other PR might apply. No strong opinion which on is better but we should become consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i followed the model of the StatsBucket aggregation :/
But both of you are right. We can make the $bucketsPath argument mandatory and remove the setter in the 2 classes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolassing : I'd leave the setters (and do the "not empty" check there, throwing an exception)
and make the argument required in the constructor
I'll cleanup the other aggregations @ruflin , but in another PR. I'd like not to have devs creating invalid objects to start with :) but this is a topic for a discussion, not here tho :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM, lets try it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But first: let's have the $bucketsPath
argument as required :)
@nicolassing Could you add a changelog entry? I think then this PR is good to go. |
*/ | ||
public function toArray(): array | ||
{ | ||
if (!$this->hasParam('buckets_path')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ! I was correcting it ^^
{ | ||
parent::__construct($name); | ||
|
||
if (null !== $bucketsPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the if condition is now always true
Merged! thanks @nicolassing for the PR, the changes and the patience 👍 |
No description provided.